{% extends 'base_course.html' %}

{% block top_content %}
  <script>
    {# I18N: This is shown to the student in a popup after registration. #}
    var regConfirmationMsg = "{{ gettext('Thank you for registering for the course. Click the Announcements tab for important information.') }}";
    if(window.location.hash == '#registration_confirmation') {
      cbShowMsg(regConfirmationMsg);
      setTimeout(function() {cbHideMsg();}, 20000);
    }
    {# I18N: This is shown to the student in a popup if registrations for the course are not open. #}
    var regClosedMsg = "{{ gettext('Registrations for this course are not open.') }}";
    if(window.location.hash == '#registration_closed') {
      cbShowMsg(regClosedMsg);
      setTimeout(function() {cbHideMsg();}, 20000);
    }
  </script>
  <div class="gcb-cols">
    <div class="gcb-col-11 gcb-aside">
      {% include 'summary.html' %}

      {% if transient_student %}
        {% include 'registration_module.html' %}
      {% endif %}
    </div>
</div>
{% endblock %}

{% block main_content %}
    <div style="margin-top: 20px;" class="gcb-cols">
      <div class="gcb-col-1">
      </div>
      <div class="gcb-col-9">

        <h1 class="gcb-schedule-headers">
          {# I18N: This should be interpreted as a noun. It is the title for the course schedule on the main contents page. #}
          {{ gettext('Schedule') }}
        </h1>
        <div id="gcb-main">
          <div style="width: 100%;" class="gcb-nav" id="gcb-nav-y">
            <ul>
              {% for unit in units %}
                {% if unit.now_available or is_course_admin %}
                  {% if unit.type == 'A' %}
                    <li><p class="gcb-top-content">
                      {% if not transient_student %}
                        {% if progress[unit.unit_id] > 0 %}
                          <img src="assets/lib/completed.png"
                               alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                               title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                               class="gcb-progress-icon"
                               id="progress-completed-{{unit.unit_id}}">
                        {% else %}
                          <img src="assets/lib/not_started.png"
                               alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet submitted') }}"
                               title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet submitted') }}"
                               class="gcb-progress-icon"
                               id="progress-notstarted-{{unit.unit_id}}">
                        {% endif %}
                      {% else %}
                        <span class="gcb-progress-empty"></span>
                      {% endif %}
                      <a href="assessment?name={{ unit.unit_id }}">{{ unit.title }}</a>

                      {% if unit.needs_human_grader %}
                        {% if not unit.now_available and is_course_admin %}
                          (Private)
                        {% endif %}
                        </p></li>
                        <li>
                          <p class="gcb-top-content">
                            <span class="gcb-progress-empty"></span>

                          {% if not transient_student %}
                            {% if unit.review_progress == 2 %}
                              <img src="assets/lib/completed.png"
                                   alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                                   title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                                   class="gcb-progress-icon"
                                   id="progress-completed-review-{{unit.unit_id}}">
                            {% elif unit.review_progress == 1 %}
                              <img src="assets/lib/in_progress.png"
                                   alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('In progress') }}"
                                   title="{# I18N: Alt text for image representing student progress. #}{{ gettext('In progress') }}"
                                   class="gcb-progress-icon"
                                   id="progress-inprogress-review-{{unit.unit_id}}">
                            {% else %}
                              <img src="assets/lib/not_started.png"
                                   alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet submitted') }}"
                                   title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet submitted') }}"
                                   class="gcb-progress-icon"
                                   id="progress-notstarted-review-{{unit.unit_id}}">
                            {% endif %}
                          {% endif %}

                          {% if unit.is_submitted %}
                            <a href="reviewdashboard?unit={{ unit.unit_id }}">
                              {% if unit.matcher == 'peer' %}
                                {# I18N: Displayed in the course contents page. Indicates a page to which students can go to review other students' assignments. #}
                                {{ gettext('Review peer assignments') }}
                              {% endif %}
                            </a>
                          {% else %}
                            <span>
                              {% if unit.matcher == 'peer' %}
                                {# I18N: Displayed in the course contents page. Indicates a page to which students can go to review other students' assignments. #}
                                {{ gettext('Review peer assignments') }}
                              {% endif %}
                            </span>
                          {% endif %}

                      {% endif %}

                  {% elif unit.type == 'U' %}
                    <li><p class="gcb-top-content">
                      {% if is_progress_recorded and not transient_student %}
                        {% if progress[unit.unit_id] == 2 %}
                          <img src="assets/lib/completed.png"
                               alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                               title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Completed') }}"
                               class="gcb-progress-icon"
                               id="progress-completed-{{unit.unit_id}}">
                        {% elif progress[unit.unit_id] == 1 %}
                          <img src="assets/lib/in_progress.png"
                               alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('In progress') }}"
                               title="{# I18N: Alt text for image representing student progress. #}{{ gettext('In progress') }}"
                               class="gcb-progress-icon"
                               id="progress-inprogress-{{unit.unit_id}}">
                        {% else %}
                          <img src="assets/lib/not_started.png"
                               alt="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet started') }}"
                               title="{# I18N: Alt text for image representing student progress. #}{{ gettext('Not yet started') }}"
                               class="gcb-progress-icon"
                               id="progress-notstarted-{{unit.unit_id}}">
                        {% endif %}
                      {% else %}
                        <span class="gcb-progress-empty"></span>
                      {% endif %}

                      <a href="unit?unit={{ unit.unit_id }}">
                        {# I18N: A row in the course schedule. #}
                        {{ gettext('Unit %(id)s - %(title)s', id=unit.index, title=unit.title) }}
                      </a>
                  {% elif unit.type == 'O' %}
                    <li>
                      <p class="gcb-top-content">
                        <span class="gcb-progress-empty"></span>
                        <a href="{{ unit.href }}"> {{ unit.title }} </a>
                  {% else %}
                    <li>
                      <p class="gcb-top-content">
                        <span class="gcb-progress-empty"></span>
                        Error: unit type not recognized.
                  {% endif %}
                      {% if not unit.now_available and is_course_admin %}
                        (Private)
                      {% endif %}
                      </p>
                    </li>
                {% else %}
                  {% if unit.type == 'A' or unit.type == 'O' %}
                    <li>
                      <p class="gcb-top-content">
                        <span class="gcb-progress-empty"></span>
                        {{ unit.title }}
                      </p>
                    </li>
                  {% elif unit.type == 'U' %}
                    <li>
                      <p class="gcb-top-content">
                        <span class="gcb-progress-empty"></span>
                        {# I18N: A row in the course schedule. #}
                        {{ gettext('Unit %(id)s - %(title)s', id=unit.index, title=unit.title) }}
                      </p>
                    </li>
                  {% else %}
                    <li>
                      <p class="gcb-top-content">
                        <span class="gcb-progress-empty"></span>
                        Error: unit type not recognized.
                      </p>
                    </li>
                  {% endif %}
                {% endif %}

              {% endfor %}
            </ul>
          </div>
        </div>

      </div>
    </div>
{% endblock %}
